import Vue from "vue";
import Router from "vue-router";
import home from "@/view/index";
import index from "@/view/home/home";
import celltable from "@/view/element/table/celltable";
// import editor from "@/view/editor/index"
let editor = () => import("@/view/editor/index")
let echarts = () => import("@/view/echarts/index")
let wangeditorindex = () => import("@/view/editor/wangEditor/index")
let wangEditorDetails = () => import("@/view/editor/wangEditor/details")
let quillindex = () => import("@/view/editor/quill/index")
let svg = () => import("@/view/svg/index")
let style = () => import("@/view/style/index")
let styleindex = () => import("@/view/style/wangEditor/index")
let styleDetails = () => import("@/view/style/wangEditor/details")
let UI = () => import("@/view/UI/index")
let baidumap = () => import("@/view/baiduMap/index")
let video = () => import("@/view/video/index")
let map =()=> import("@/view/echarts/components/map/mapLine")
let threeDmap =()=> import("@/view/echarts/components/map/threeDmap")
let mapcard =()=> import("@/view/echarts/components/map/mapCard")
let jsc =()=> import("@/view/jsc/index")
Vue.use(Router)

// editor 的子路由
let editorChildren = [
  {
    path: "quillindex",
    name: "quillindex",
    meta: {
      active: "/editor"
    },
    component: quillindex
  },
  {
    path: "wangeditorindex",
    name: "wangeditorindex",
    meta: {
      active: "/editor"
    },
    component: wangeditorindex
  },
  {
    path: "wangEditorDetails",
    name: "wangEditorDetails",
    meta: {
      active: "/editor"
    },
    component: wangEditorDetails
  }
];

// echarts的子路由
let echartsChildren = [
  {
    // path: 'home',
    // name: 'index',
    // meta: {
    //   active: "/home"
    // },
    // component: index,
  }
];
// home 的子路由
let homeChildren = [
  {
    path: "home",
    name: "index",
    meta: {
      active: "/home"
    },
    component: index
  },
  {
    path: "celltable",
    name: "celltable",
    meta: {
      active: "/celltable"
    },
    component: celltable
  },
  {
    path: "editor",
    name: "editor",
    meta: {
      active: "/editor"
    },
    redirect: {
      path: "/editor/wangeditorindex"
    }, //跳转到下级第一层
    component: editor,
    children: editorChildren
  },
  {
    path: "echarts",
    name: "echarts",
    meta: {
      active: "/echarts"
    },
    component: echarts
    // children: echartsChildren
  },
  {
    path: "svg",
    name: "svg",
    meta: {
      active: "/svg"
    },
    component: svg
  },
  {
    path: "style",
    name: "style",
    meta: {
      active: "/style"
    },
    component: style
  },
  {
    path: "styleindex",
    name: "styleindex",
    meta: {
      active: "/styleindex"
    },
    component: styleindex
  },
  {
    path: "styleDetails",
    name: "styleDetails",
    meta: {
      active: "/styleDetails"
    },
    component: styleDetails
  },
  {
    path: "UI",
    name: "UI",
    meta: {
      active: "/UI"
    },
    component: UI
  },
  {
    path: '/mapcard',
    name: 'mapcard',
    component: mapcard,
    meta: {
      active: "/mapcard"
    },
  },
  {
    path: "baidumap",
    name: "baidumap",
    meta: {
      active: "/baidumap"
    },
    component: baidumap
  },
  {
    path: "video",
    name: "video",
    meta: {
      active: "/video"
    },
    component: video
  }
];

export default new Router({
  routes: [
    {
      path: "/",
      name: "home",
      component: home,
      meta: {
        active: "/home"
      },
      children: homeChildren
    },
    {
      path: "/map",
      name: "map",
      component: map,
      meta: {
        active: "/map"
      }
    },

    {
      path: "/3dmap",
      name: "threeDmap",
      component: threeDmap,
      meta: {
        active: "/3dmap"
      }
    },
    {
      path: "/jsc",
      name: "jsc",
      component: jsc,
      meta: {
        active: "/jsc"
      }
    },
    {
      path: "*", //*:任何不存在路由
      redirect: "/home" //redirect:重定向
    }
  ]
});
